var identity = require("./identity");
var isFunction = require("./03_isFunction");
var optimizeCb = require("./01_optimizeCb");
var isObject = require("./04_isObject");
const matcher = require("./06_matcher");
const property = require("./12_property");

function cb(value, context, argCount) {
  if (value == null) return identity;
  if (isFunction(value)) return optimizeCb(value, context, argCount);
  if (isObject(value)) return matcher(value);
  return property(value);
}

module.exports = cb;
